//
//  SendCodeButton.swift
//  AESOLAR_IOS
//
//  Created by Mr.Wang on 2019/9/11.
//  Copyright © 2019 Mr.Wang. All rights reserved.
//

import UIKit

class SendCodeButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        let color = #colorLiteral(red: 0.9679408669, green: 0.8499000669, blue: 0.6221744418, alpha: 1)
        self.setBackgroundImage(UIImage.imageWithColor(APPConfig.baseColor), for: .normal)
        self.setBackgroundImage(UIImage.imageWithColor(color), for: .disabled)
        self.clipsToBounds = true
        self.setTitleColor(.white, for: .normal)
        self.layer.cornerRadius = 4
        self.titleLabel?.font = UIFont.monospacedDigitSystemFont(ofSize: 13, weight: .medium)
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        if let width = self.titleLabel?.width {
            self.width = width + 20
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
